#!/usr/bin/perl -w

@names = qw{ fred betty barney dino wilma prbbles bamm-bamm };
print "Enter some numbers 1 to 7, one per line, then press ctrl-D:\n";
chomp(@numbers = <STDIN>);
foreach (@numbers) {
    if ($_ > 7 || $_ < 0) {
        $num += 1;
        print "错误输入第$num次";
    }
    print "$names[$_ - 1]\n";
}

